home *** CD-ROM | disk | FTP | other *** search
/ Mac Easy 2010 May / Mac Life Ubuntu.iso / casper / filesystem.squashfs / usr / bin / f-spot-import < prev    next >
Encoding:
Text File  |  2009-04-08  |  940 b   |  36 lines

  1. #!/bin/bash
  2.  
  3. udi="$1"
  4.  
  5. if [ "$udi" != "${udi#gphoto2:}" ]; then
  6.     # gphoto gvfs source, pass it on unmodified
  7.  
  8.     # make sure it's not mounted by gvfs, otherwise we can't access the camera
  9.     # (current F-Spot version does not yet understand GIO)
  10.     gvfs-mount -u "$udi" || true
  11.  
  12.     # transform GIO URL to a format f-spot understands
  13.     uri=`echo "$udi" | sed 's_://\[_:_; s_/$__; s_\]$__'`
  14.  
  15.     exec f-spot --import "$uri"
  16.     exit 1
  17. fi
  18.  
  19. #xmessage $udi
  20. mount_point=`hal-get-property --udi="$udi" --key=volume.mount_point`
  21. if [ -n "$mount_point" ]; then
  22.       # USB Mass Storage camera: need to pass f-spot a mount point
  23.  
  24.       f-spot --import "$mount_point"
  25. else
  26.      # Some other camera try GPhoto2
  27.  
  28.      bus=`hal-get-property --udi="$udi" --key=usb.bus_number`
  29.      dev=`hal-get-property --udi="$udi" --key=usb.linux.device_number`
  30.      uri=`printf gphoto2:usb:%.3d,%.3d $bus $dev`
  31.  
  32.      echo $uri
  33.  
  34.      f-spot --import "$uri"
  35. fi
  36.